/**********************************************************************/
/*  SECTION 4: Analysis using observed data	
    Notes: 
	Author: Fumiya Uchikoshi

		*/
/**********************************************************************/

use "Data/imp.dta",replace
keep if _mi_m == 0
mi xtset after yearx

********************************************
* Table A1
********************************************
local econ1 "onsenchi_w onsenchi_b farming_w farming_b logpop_w logpop_b income_w income_b unemployment_w unemployment_b health_w health_b construction_w construction_b lfp_w lfp_b onsenchi_std_w onsenchi_std_b"
local soci1 "turnout_w turnout_b crime_w crime_b ldpvote_w ldpvote_b homerate_w homerate_b under15_w under15_b marmale_w marmale_b totcwins_w totcwins_b"
local control "logpot sumexlagdm_b sumexlagdm_w fourdiv3 fourdiv4 nptypex3_w nptypex3_b changebde_w changebde_b yearx1 yearx2 yearx3 yearx4 yearx6 yearx7 yearx8" 

 estpost tabstat exdm_m `econ1' `soci1' `control', statistics(n mean sd min max) columns(statistics) 
 esttab . using `"Results/A1[DescriptiveStats].csv"', replace cells("count(fmt(0)) mean(fmt(2)) sd(fmt(2)) min(fmt(2)) max(fmt(2))") wide nostar unstack noobs nonote label

********************************************
* Table A6
********************************************
local econ1 "onsenchi_w onsenchi_b farming_w farming_b logpop_w logpop_b income_w income_b unemployment_w unemployment_b health_w health_b"
local econ2 "onsenchi_w onsenchi_b farming_w farming_b logpop_w logpop_b income_w income_b health_w health_b"
local econ3 "onsenchi_w onsenchi_b farming_w farming_b logpop_w logpop_b income_w income_b"
local soci1 "turnout_w turnout_b crime_w crime_b ldpvote_w ldpvote_b"
local soci2 "turnout_w turnout_b"
local control "logpot sumexlagdm_b sumexlagdm_w fourdiv3 fourdiv4 nptypex3_w nptypex3_b changebde_w changebde_b yearx1 yearx2 yearx3 yearx4 yearx6 yearx7 yearx8" 

eststo: qui xtlogit exdm_m `econ1' `soci1' `control', re nolog
est sto model1
eststo: qui xtlogit exdm_m `econ2' `soci2' `control', re nolog
est sto model2
eststo: qui xtlogit exdm_m `econ1' `soci1' `control' if yearx8 == 0, re nolog
est sto model3
eststo: qui xtlogit exdm_m `econ2' `soci2' `control' if yearx8 == 0, re nolog
est sto model4
eststo: qui xtlogit exdm_m `econ3' `soci2' `control', re nolog
est sto model5
eststo: qui xtlogit exdm_m `econ3' `control', re nolog
est sto model6
eststo: qui xtlogit exdm_m `econ3' `soci2' `control' if yearx8 == 0, re nolog
est sto model7
eststo: qui xtlogit exdm_m `econ3' `control' if yearx8 == 0, re nolog
est sto model8
esttab model1 model2 model3 model4 model5 model6 model7 model8 using `"Results/A6[Obs].csv"', wide scalar(N ll aic bic r2_p) se star(* 0.10 ** 0.05 *** 0.01) b(3) label  replace title(Exploration)
